import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from "rxjs";
import { NotificationModel } from "./model/notification.model";
import { BaseHttpService } from "../../../shared/services/baseHttp.service";

@Injectable()
export class NotificationsService extends BaseHttpService {
    constructor(private http: HttpClient) {
        super();
    }

    public getNotification(): Observable<NotificationModel> {
        return this.http.get<NotificationModel>(this.serverUrl + '/newsserv/api/v1/notifications');
    }

    public updateNotification(notification: NotificationModel): Observable<void> {
        return this.http.post<void>(this.serverUrl + '/newsserv/api/v1/notifications', notification);
    }
}